<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="LVS," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="一、环境需求&amp;amp;安装LVS软件环境准备：三台虚拟机&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;此环境是针对内部服务的LVS架构，如数据库，缓存，共享存储等业务。    虚拟机角色 IP地址 备注     LVS负载均衡器 192.168.41.181 VIP地址：192.168.40.17   http服务器 RS1192.168.41.3">
<meta name="keywords" content="LVS">
<meta property="og:type" content="article">
<meta property="og:title" content="LVS原理详解及部署之三：手动部署LVS">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/LVS/10. LVS原理详解及部署之三：手动部署LVS/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="一、环境需求&amp;amp;安装LVS软件环境准备：三台虚拟机&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;此环境是针对内部服务的LVS架构，如数据库，缓存，共享存储等业务。    虚拟机角色 IP地址 备注     LVS负载均衡器 192.168.41.181 VIP地址：192.168.40.17   http服务器 RS1192.168.41.3">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-09-01T08:52:23.083Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="LVS原理详解及部署之三：手动部署LVS">
<meta name="twitter:description" content="一、环境需求&amp;amp;安装LVS软件环境准备：三台虚拟机&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;此环境是针对内部服务的LVS架构，如数据库，缓存，共享存储等业务。    虚拟机角色 IP地址 备注     LVS负载均衡器 192.168.41.181 VIP地址：192.168.40.17   http服务器 RS1192.168.41.3">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/LVS/10. LVS原理详解及部署之三：手动部署LVS/"/>





  <title>LVS原理详解及部署之三：手动部署LVS | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/LVS/10. LVS原理详解及部署之三：手动部署LVS/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">LVS原理详解及部署之三：手动部署LVS</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T02:04:46+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="一、环境需求-amp-安装LVS软件"><a href="#一、环境需求-amp-安装LVS软件" class="headerlink" title="一、环境需求&amp;安装LVS软件"></a>一、环境需求&amp;安装LVS软件</h2><h3 id="环境准备：三台虚拟机"><a href="#环境准备：三台虚拟机" class="headerlink" title="环境准备：三台虚拟机"></a>环境准备：三台虚拟机</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;此环境是针对内部服务的LVS架构，如数据库，缓存，共享存储等业务。</p>
<table>
<thead>
<tr>
<th>虚拟机角色</th>
<th>IP地址</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>LVS负载均衡器</td>
<td>192.168.41.181</td>
<td>VIP地址：192.168.40.17</td>
</tr>
<tr>
<td>http服务器</td>
<td>RS1192.168.41.31</td>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</td>
</tr>
<tr>
<td>http服务器</td>
<td>RS2192.168.41.33</td>
<td>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</td>
</tr>
</tbody>
</table>
<h3 id="安装LVS软件"><a href="#安装LVS软件" class="headerlink" title="安装LVS软件"></a>安装LVS软件</h3><ol>
<li><p>在安装LVS软件之前，先确定两条HTTPserver是能够正常访问的。</p>
</li>
<li><p>下载软件</p>
</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这里使用的2.4版本，并且注意内核是2.6版本的，如果版本是6.X版本的话，那么可以使用2.6版本</p>
<ol>
<li>编译安装</li>
</ol>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;需要创建一个软连接：ln -s /usr/src/kernels/<strong>2.6.18-238.el5-i686</strong> /usr/src/linux</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;此处粗体根据自己的系统来进行定义，可以使用tab键来补齐。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">tar -zxf ipvsadm-1.24.tar.gz</div><div class="line"><span class="built_in">cd</span> ipvsadm-1.24</div><div class="line">make</div><div class="line">make install</div><div class="line">lsmod |grep ip_vs</div><div class="line">ipvsadm</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;因为此时系统还没有把ipvs模块加载进系统，需要我们执行ipvsadm命令才会加载进去,或者modprobe ip_vs。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@localhost ipvsadm-1.24]<span class="comment"># lsmod |grep ip_vs</span></div><div class="line">ip_vs_rr 6081 1</div><div class="line">ip_vs 78081 3 ip_vs_rr</div></pre></td></tr></table></figure>
<h2 id="二、手动配置LVS负载均衡器"><a href="#二、手动配置LVS负载均衡器" class="headerlink" title="二、手动配置LVS负载均衡器"></a>二、手动配置LVS负载均衡器</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;正常工作中是不会手动配置的，也不会使用脚本配置的。最终我们是通过配置文件生效的，结合keepalived来进行部署的。</p>
<ol>
<li>负载均衡器上配置VIP地址</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">ifconfig eth0:1 192.168.40.17 netmask 255.255.254.0</div><div class="line">route add -host 192.168.40.17  dev eth0</div></pre></td></tr></table></figure>
<ol>
<li>ipvsadm添加LVS服务</li>
</ol>
<table>
<thead>
<tr>
<th>参数</th>
<th>参数说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>-A</td>
<td>-A –add-service 添加一个带选项的虚拟服务。Add a virtual service. A serviceaddress is uniquely defined by a triplet: IP address, portnumber, and protocol. Alternatively a virtualservice may be defined by a firewall-mark.</td>
</tr>
<tr>
<td>-t</td>
<td>指定虚拟服务器的IP地址和端口</td>
</tr>
<tr>
<td>-s</td>
<td>-s,–scheduler scheduling-method 调度算法</td>
</tr>
<tr>
<td>-p</td>
<td>会话保持按秒计算</td>
</tr>
<tr>
<td>-a</td>
<td>-a在对应的VIP下添加RS节点</td>
</tr>
<tr>
<td>-g</td>
<td>指定此LVS的工作模式为-g -g为DR模式</td>
</tr>
<tr>
<td>-l</td>
<td>指定LVS的工作模式为-l -l为tunnel模式</td>
</tr>
<tr>
<td>-m</td>
<td>指定LVS的工作模式为NAT模式</td>
</tr>
<tr>
<td>-w</td>
<td>指定RS节点的权重</td>
</tr>
<tr>
<td>-D</td>
<td>删除虚拟服务.格式：ipvsadm-D -t</td>
<td>u</td>
<td>f service-address. Delete a virtual service, alongwith any associated real servers.</td>
</tr>
<tr>
<td>-C</td>
<td>-C, –clear Clear the virtual server table清空lvs原有的配置。</td>
</tr>
<tr>
<td>-set</td>
<td>设置tcp tcpfn udp 的连接超时时间（一般来说高并发的时候小一点点。</td>
</tr>
</tbody>
</table>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">ipvsadm  -C                                                <span class="comment">#请用LVS原有的配置</span></div><div class="line">ipvsadm -A -t 192.168.40.17:80 -s rr -p 20                 <span class="comment">#添加虚拟服务指定VIP</span></div><div class="line">ipvsadm -a -t 192.168.40.17:80 -r 192.168.41.31:80 -g -w 10<span class="comment">#针对虚拟服务添加RS节点</span></div><div class="line">ipvsadm -a -t 192.168.40.17:80 -r 192.168.41.33:80 -g -w 10</div><div class="line">ipvsadm -L -n                                              <span class="comment">#查看VIP和RS是否已经配置成功。</span></div></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># ipvsadm -L -n</span></div><div class="line">IP Virtual Server version 1.2.1 (size=4096)</div><div class="line">Prot LocalAddress:Port Scheduler Flags</div><div class="line"> -&gt; RemoteAddress:Port Forward Weight ActiveConn InActConn</div><div class="line">TCP 192.168.40.17:80 rr persistent 20</div><div class="line"> -&gt; 192.168.41.33:80 Route 10 0 0 </div><div class="line"> -&gt; 192.168.41.31:80 Route 10 0 0</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LB上删除虚拟服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ipvsadm -D -t 192.168.40.17:80</div></pre></td></tr></table></figure>
<h2 id="三、RS节点服务器手动配置"><a href="#三、RS节点服务器手动配置" class="headerlink" title="三、RS节点服务器手动配置"></a>三、RS节点服务器手动配置</h2><ol>
<li>添加lo端口的VIP&amp;路由</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ifconfig lo 192.168.40.17 netmask 255.255.255.255</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(由于RS的VIP不是用来通讯，并且这里一定要设置24位掩码）</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">route add -host 192.168.40.17  dev lo</div></pre></td></tr></table></figure>
<ol>
<li>ARP抑制</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">echo</span> <span class="string">"1"</span>&gt;/proc/sys/net/ipv4/conf/lo/arp_ignore</div><div class="line"><span class="built_in">echo</span> <span class="string">"2"</span>&gt;/proc/sys/net/ipv4/conf/lo/arp_announce </div><div class="line"><span class="built_in">echo</span> <span class="string">"1"</span>&gt;/proc/sys/net/ipv4/conf/all/arp_announce</div><div class="line"><span class="built_in">echo</span> <span class="string">"2"</span>&gt;/proc/sys/net/ipv4/conf/all/arp_announce</div></pre></td></tr></table></figure>
<h2 id="四、测试LVS是否生效"><a href="#四、测试LVS是否生效" class="headerlink" title="四、测试LVS是否生效"></a>四、测试LVS是否生效</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在LB上面输入命令ipvsadm -L -n就能够查看LB上面的会话分配。在前面加上watch可以动态的查看ipvsadm的会话分配。watch ipvsadm -L -n.</p>
<ol>
<li>测试RS节点是否正常访问</li>
<li>测试从LB能否正常访问RS</li>
<li>测试客户端能否正常访问VIP</li>
</ol>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在测试的时候可以先把防火墙关闭掉，一般按照这样配置就能够实现LVS的负载均衡了。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;至此我们的LVS DR模式负载均衡已经配置完成了。至于不同的调度算法啊-s  不同的工作模式-g(DR) -l(TUNNEL) -m(NAT)服务器端基本上没有什么差别。只是在客户端上有一定的差别。</p>
<h3 id="NAT模式："><a href="#NAT模式：" class="headerlink" title="NAT模式："></a>NAT模式：</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;客户端同样需要配置VIP，进行ARP抑制，并且要服务器端开启内核转发功能，配置LB的DIP(内网IP地址）作为默认网关。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;开启内核转发功能：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">vim /etc/sysctl</div><div class="line"></div><div class="line">net.ipv4.ip_forword = 1</div><div class="line">route add default gw  192.168.41.181</div></pre></td></tr></table></figure>
<h3 id="Tunnel模式："><a href="#Tunnel模式：" class="headerlink" title="Tunnel模式："></a>Tunnel模式：</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;客户端需要先开启Tunnel协议支持。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">/sbin/modprobe ipip</div><div class="line">/sbin/route add –host 192.168.40.17 devtun1</div><div class="line"><span class="built_in">echo</span>”1”&gt;/proc/sys/net/ipv4/conf/tun1/arp-ignore</div><div class="line"><span class="built_in">echo</span>”2”&gt;/proc/sys/net/ipv4/conf/tun1/arp_announce</div><div class="line"><span class="built_in">echo</span>”0” &gt;/proc/sys/net/ipv4/conf/tun1/rp_filter</div><div class="line"><span class="built_in">echo</span>”1” &gt;/proc/sys/net/ipv4/conf/tun1/forwarding</div><div class="line"><span class="built_in">echo</span>”1” &gt;/proc/sys/net/ipv4/conf/all/arp_ignore</div><div class="line"><span class="built_in">echo</span>”2” &gt;/proc/sys/net/ipv4/conf/all/ arp_announce</div></pre></td></tr></table></figure>
<h2 id="五、部署成功后的另一些问题"><a href="#五、部署成功后的另一些问题" class="headerlink" title="五、部署成功后的另一些问题"></a>五、部署成功后的另一些问题</h2><ol>
<li>当我们的RS节点出现问题，LB如何知道。如果不知道是会把会话连接接续转发到RS上面。</li>
<li>如果LB出现故障，那么整个网络就出现故障。</li>
</ol>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;针对上面的1问题，我们就需要一种RS节点健康检查机制。定时的去检测RS是否正常，如果出现不正常那么就把这个RS从VIP服务里面删除掉。如果恢复正常了，就再把RS添加进来。针对2问题，我们可以另外再架设一台LB服务器，作为备LB服务器。那么当主LB出现故障，备LB服务器就会启动接管主LB服务器的工作，接管它的资源（IP地址，在网络中的角色身份等）</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;而上面提到的这些我们就需要结合keepalived来完成。所以后续我们开始讲keepalived+lvs结合适用。完成RS节点健康检查和LVS的高可用性功能。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/LVS/" rel="tag"># LVS</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/LVS/1. LVS 的 dr 模式/" rel="next" title="LVS 的 dr 模式">
                <i class="fa fa-chevron-left"></i> LVS 的 dr 模式
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/LVS/11. LVS原理详解及部署之四：keepalived介绍/" rel="prev" title="LVS原理详解及部署之四：keepalived介绍">
                LVS原理详解及部署之四：keepalived介绍 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#一、环境需求-amp-安装LVS软件"><span class="nav-number">1.</span> <span class="nav-text">一、环境需求&安装LVS软件</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#环境准备：三台虚拟机"><span class="nav-number">1.1.</span> <span class="nav-text">环境准备：三台虚拟机</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装LVS软件"><span class="nav-number">1.2.</span> <span class="nav-text">安装LVS软件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二、手动配置LVS负载均衡器"><span class="nav-number">2.</span> <span class="nav-text">二、手动配置LVS负载均衡器</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#三、RS节点服务器手动配置"><span class="nav-number">3.</span> <span class="nav-text">三、RS节点服务器手动配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#四、测试LVS是否生效"><span class="nav-number">4.</span> <span class="nav-text">四、测试LVS是否生效</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#NAT模式："><span class="nav-number">4.1.</span> <span class="nav-text">NAT模式：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Tunnel模式："><span class="nav-number">4.2.</span> <span class="nav-text">Tunnel模式：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#五、部署成功后的另一些问题"><span class="nav-number">5.</span> <span class="nav-text">五、部署成功后的另一些问题</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
